#ifndef QFORMLISTWIDGET_H
#define QFORMLISTWIDGET_H

#include <QWidget>
#include <QMap>
#include <QList>

class   WidgetHost;
class   QFormWidget;

namespace SHAREDLIB
{
    class XMLObject;
    class QPageInfo;
}

class QFormListWidget : public QWidget
{
    Q_OBJECT
public:
    explicit QFormListWidget(QWidget *parent = 0);

    void    showForm(SHAREDLIB::QPageInfo* info);
    SHAREDLIB::QPageInfo* pageInfo(QFormWidget *wid);
    QFormWidget *currentForm();

    void    clear();

    void    left();
    void    h_center();
    void    right();
    void    top();
    void    v_center();
    void    bottom();

    void    sameWidth();
    void    sameHeight();
    void    sameGemotry();

    void    make_page_position(QVariant &param);
    void    set_page_position(const QVariant &param);

    bool    page_position(const QVariant& param);
protected slots:
    void    addForm(SHAREDLIB::QPageInfo *info);
    void    removeForm(SHAREDLIB::QPageInfo *info);
protected:
    SHAREDLIB::XMLObject *getXML(QWidget *wid, SHAREDLIB::XMLObject *par);
signals:
    void    selectWidget(QWidget* wid);
    void    showFormSignal(QWidget* form);
    void    formAddSignal(QWidget* wid);
    void    formAddWidget(QWidget* wid,int);
    void    widgetRemove(QWidget* wid);
    void    need_make_page_position();
protected slots:
    void    projectOpen();
    void    projectClosed();
    void    projectSave();
    void    refreshForm();

    void    copy();
    void    cut();
    void    paste();
    void    del();
    void    selectAll();

    void    select_changed();
    void    clipboard_changed();
protected:
    QList<WidgetHost*>         m_formlist;
    QMap<SHAREDLIB::QPageInfo*,QFormWidget*> m_infoToForm;
    QMap<QFormWidget*,SHAREDLIB::QPageInfo*> m_formToInfo;
    SHAREDLIB::QPageInfo*                    m_current;
    QList<QAction*>             m_form_action_list;
};

#endif // QFORMLISTWIDGET_H
